import React from 'react'
// ===================================================================== Temp
import SearchForm from '#cpt/temp/SearchForm'
import Table from '#cpt/temp/Table'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// =====================================================================Lazy
const Page = $Lazy.load(()=>import('#tp/page/page-container'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		selectedKeys:[],
		// 搜索表单列表
		forms : [
			{ label:'标箱编号',		name: 'box_number' },
			{ label:'使用时间',  	names: ['created_at_start_date','created_at_end_date'], type:'date-range' },
		],
	}
	
	model = {}
	
	componentDidMount(){
		if(window.isInit){
		  this.fetch()
		}
	}
	// paging
	fetch = () => $fn.fetch.call(this,'boxlogs/index')
	
	// 表单
	cols = [
		{ title: '标箱编号', 		dataIndex: 'box_number', 		width:120 },
		{ title: '业务员名', 		dataIndex: 'receiver_name', 	...$fn.table.name },
		{ title: '使用内容', 		dataIndex: 'content', 		width:150 },
		{ title: '使用时间', 		dataIndex: 'created_at', 		...$fn.table.time },
	]
	
	render(){
		return (
			<Page title='标箱记录'>
				{/* 搜索 */}
				{ SearchForm.call(this) }
				{/* 表格 */}
				{ Table.call(this, { type: -1, isInit: window.isInit }) }
			</Page>
		)
	}
}

export default Index